home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Hardware / Mac OS USB DDK v1.3f3 / Interfaces / UniversalHIDModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-20  |  6.1 KB  |  196 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        UniversalHIDModule.h
  3.  
  4.     Contains:    This describes the interface a higher level part of the OS uses
  5.                 to talk with a UniversalHIDModule, and the way to implement
  6.                 a UniversalHIDModule compliant HID module.
  7.                 
  8.                 This file is checked in in addition to UniversalHIDModule.i, see the
  9.                 comments _there_ on how to make changes to this file!
  10.                 
  11.                 DO NOT CHANGE THIS FILE W/O CHANGING UniversalHIDModule.i FIRST
  12.  
  13.     Version:    xxx put version here xxx
  14.  
  15.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  16.  
  17. */
  18. /*
  19.      File:        UniversalHIDModule.h
  20.  
  21.      Contains:    This describes the interface a higher level part of the OS uses
  22.  
  23.      Version:    xxx put version here xxx
  24.  
  25.      DRI:        Brent Schorsch
  26.  
  27.      Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  28.  
  29.      Warning:    *** APPLE INTERNAL USE ONLY ***
  30.                  This file may contain unreleased API's
  31.  
  32.      BuildInfo:    Built by:            Steve Bollinger
  33.                  With Interfacer:    3.0d8   (PowerPC native)
  34.                  From:                UniversalHIDModule.i
  35.                      Revision:        3*
  36.                      Dated:            7/9/98
  37.                      Last change by:    sjb
  38.                      Last comment:    remove extraneous parameter
  39.  
  40.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  41.                  List the version information (from above) in the Problem Description.
  42.  
  43. */
  44. /*
  45.     The .i file is _not_ automatically built. The .h file is currently checked in also. 
  46.     If you wish to build this file, you can execute the following lines, then copy the results
  47.     into the UniversalHIDModule.h file that is at :Neptune:Interfaces:
  48.     
  49.             Set -e MasterInterfaces             "`GetProjectCheckoutDir -team {CurrentTeam} -project MasterInterfacesProj`"
  50.             Set -e MasterInterfacesAPI            "{MasterInterfaces}Interfaces:"
  51.             Duplicate {Active} {MasterInterfacesAPI}
  52.             Open {MasterInterfacesAPI}UniversalHIDModule.i
  53.             {BBSCmds}InterfacerActiveWindow
  54.             Close {MasterInterfacesAPI}UniversalHIDModule.i
  55. */
  56. /* We are not USB specific, but we share many definitions with the USB spec*/
  57. #ifndef __UNIVERSALHIDMODULE__
  58. #define __UNIVERSALHIDMODULE__
  59.  
  60. #ifndef __MACTYPES__
  61. #include <MacTypes.h>
  62. #endif
  63. #ifndef __USB__
  64. #include <USB.h>
  65. #endif
  66.  
  67.  
  68.  
  69. #if PRAGMA_ONCE
  70. #pragma once
  71. #endif
  72.  
  73. #ifdef __cplusplus
  74. extern "C" {
  75. #endif
  76.  
  77. #if PRAGMA_IMPORT
  78. #pragma import on
  79. #endif
  80.  
  81. #if PRAGMA_STRUCT_ALIGN
  82.     #pragma options align=mac68k
  83. #elif PRAGMA_STRUCT_PACKPUSH
  84.     #pragma pack(push, 2)
  85. #elif PRAGMA_STRUCT_PACK
  86.     #pragma pack(2)
  87. #endif
  88.  
  89. typedef UInt32                             UHIDModuleConnectionID;
  90. /* FunctionPtr to be called when inturrupt occurs*/
  91. typedef CALLBACK_API_C( void , UHIDInterruptProcPtr )(void *theData, UInt32 refcon);
  92. /* FunctionPtr definitions for UniversalHIDModule dispatch table*/
  93. typedef CALLBACK_API_C( OSStatus , UHIDGetDeviceInfoProcPtr )(UInt32 inInfoSelector, void *outInfo);
  94. typedef CALLBACK_API_C( OSStatus , UHIDGetHIDDescriptorProcPtr )(UInt32 inDescriptorType, UInt32 inDescriptorIndex, UInt32 *ioBufferSize, void *outBuffer);
  95. typedef CALLBACK_API_C( OSStatus , UHIDClaimDeviceProcPtr )(UHIDModuleConnectionID *outConnectionID, UInt32 reserved);
  96. typedef CALLBACK_API_C( OSStatus , UHIDReleaseDeviceProcPtr )(UHIDModuleConnectionID inConnectionID);
  97. typedef CALLBACK_API_C( OSStatus , UHIDInstallInterruptProcPtr )(UHIDModuleConnectionID inConnectionID, UHIDInterruptProcPtr inInterruptProc, UInt32 inRefcon);
  98. typedef CALLBACK_API_C( OSStatus , UHIDControlDeviceProcPtr )(UHIDModuleConnectionID inConnectionID, UInt32 inControlSelector, void *ioControlData);
  99.  
  100. enum {
  101.     kCurrentDispatchTableVersion = 5,
  102.     kOldestCompatableDispatchTableVersion = 5
  103. };
  104.  
  105. /*
  106.    UHIDModuleDispatchTable is exported by the HIDModule's PEF container
  107.    dispatchTableCurrentVersion is kCurrentDispatchTableVersion
  108.    dispatchTableOldestVersion is kOldestCompatableDispatchTableVersion
  109.           (the oldest built client using this API that this UHIDModule will work with)
  110.    vendorID is who wrote this UniversalHIDModule (hi word of 0 and USB vendorID is valid)
  111. */
  112.  
  113. struct UHIDModuleDispatchTableStruct {
  114.     UInt16                             dispatchTableCurrentVersion;
  115.     UInt16                             dispatchTableOldestVersion;
  116.     UInt32                             vendorID;
  117.     UInt32                             vendorSpecific;
  118.     UInt32                             reserved;
  119.     UHIDGetDeviceInfoProcPtr         pUHIDGetDeviceInfo;
  120.     UHIDClaimDeviceProcPtr             pUHIDClaimDevice;
  121.     UHIDReleaseDeviceProcPtr         pUHIDReleaseDevice;
  122.     UHIDInstallInterruptProcPtr     pUHIDInstallInterrupt;
  123.     UHIDControlDeviceProcPtr         pUHIDControlDevice;
  124.     UHIDGetHIDDescriptorProcPtr     pUHIDGetHIDDescriptor;
  125. };
  126. typedef struct UHIDModuleDispatchTableStruct UHIDModuleDispatchTableStruct;
  127.  
  128. typedef UHIDModuleDispatchTableStruct     UHIDModuleDispatchTable;
  129. typedef UHIDModuleDispatchTableStruct *    UHIDModuleDispatchTablePtr;
  130. /* the prototypes for the actual functions in the UHIDModule follow*/
  131. EXTERN_API_C( OSStatus )
  132. UHIDGetDeviceInfo                (UInt32                 inInfoSelector,
  133.                                  void *                    outInfo);
  134.  
  135. EXTERN_API_C( OSStatus )
  136. UHIDGetHIDDescriptor            (UInt32                 inDescriptorType,
  137.                                  UInt32                 inDescriptorIndex,
  138.                                  UInt32 *                ioBufferSize,
  139.                                  void *                    outBuffer);
  140.  
  141. /* Claim and release are a way to insure that only one client is connected*/
  142. EXTERN_API_C( OSStatus )
  143. UHIDClaimDevice                    (UHIDModuleConnectionID * outConnectionID,
  144.                                  UInt32                 reserved);
  145.  
  146. EXTERN_API_C( OSStatus )
  147. UHIDReleaseDevice                (UHIDModuleConnectionID  inConnectionID);
  148.  
  149. EXTERN_API_C( OSStatus )
  150. UHIDInstallInterrupt            (UHIDModuleConnectionID  inConnectionID,
  151.                                  UHIDInterruptProcPtr     inInterruptProc,
  152.                                  UInt32                 inRefcon);
  153.  
  154. EXTERN_API_C( OSStatus )
  155. UHIDControlDevice                (UHIDModuleConnectionID  inConnectionID,
  156.                                  UInt32                 inControlSelector,
  157.                                  void *                    ioControlData);
  158.  
  159. /* these are the constants to be passed to UHIDControlDevice*/
  160.  
  161. enum {
  162.     kUHIDRemoveInterruptHandle    = 0,
  163.     kUHIDVendorSpecificControlStart = 0x00010000
  164. };
  165.  
  166. /* these are the constants to be passed to UHIDGetDeviceInfo*/
  167.  
  168. enum {
  169.     kUHIDGetVendorID            = 0,
  170.     kUHIDGetProductID            = 1,
  171.     kUHIDGetMaxPacketSize        = 2,
  172.     kUHIDVendorSpecificGetInfoStart = 0x00010000
  173. };
  174.  
  175.  
  176. #if PRAGMA_STRUCT_ALIGN
  177.     #pragma options align=reset
  178. #elif PRAGMA_STRUCT_PACKPUSH
  179.     #pragma pack(pop)
  180. #elif PRAGMA_STRUCT_PACK
  181.     #pragma pack()
  182. #endif
  183.  
  184. #ifdef PRAGMA_IMPORT_OFF
  185. #pragma import off
  186. #elif PRAGMA_IMPORT
  187. #pragma import reset
  188. #endif
  189.  
  190. #ifdef __cplusplus
  191. }
  192. #endif
  193.  
  194. #endif /* __UNIVERSALHIDMODULE__ */
  195.  
  196.